import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';

import 'action.dart';
import 'state.dart';
import 'package:rss_readneed/public.dart';


Widget buildView(sn_supportState state, Dispatch dispatch, ViewService viewService) {
  return Scaffold(
    appBar: AppbarCommon(ctx: viewService.context,titleString: "苏格拉宁"),
    body: ListView(
      padding: EdgeInsets.all(8),
      children: <Widget>[
        SizedBox(height: 20,),
        ListTile(
          leading: SizedBox(child: Icon(Icons.account_circle,color: (state.focusIndex == 0) ? mainColor : Colors.black38,),height: double.infinity,),
          title: TextField(
            controller: state.nameController,
            decoration: InputDecoration(
              labelText: "账号",
              hintText: "请输入工号",
              border: OutlineInputBorder(),//全边框样式
            ),
            onTap: (){ dispatch(sn_supportActionCreator.focusAction(0)); },
          ),
        ),
        ListTile(
          leading: SizedBox(child: Icon(Icons.lock,color: (state.focusIndex == 1) ? mainColor : Colors.black38,),height: double.infinity,),
          title: TextField(
            controller: state.passController,
//            obscureText: true,//密码*隐藏 - cookie无需隐藏
            decoration: InputDecoration(
              labelText: "Cookies",
              hintText: "请填入Cookies",
              border: OutlineInputBorder(),//全边框样式
            ),
            onTap: (){ dispatch(sn_supportActionCreator.focusAction(1)); },
          ),
        ),
        SizedBox(height: 10,),
        RaisedButton(
          padding: EdgeInsets.all(6),
          child: Text("登录",style: TextStyle(fontWeight: FontWeight.w500,fontSize: 20,color:Colors.white ),),
          color: mainColor,
          onPressed: () { dispatch(sn_supportActionCreator.loginAction());},

        ),
      ],
    ),

  );
}
